import React, { useRef } from 'react'
import {useState,useEffect} from "react"
import {useDispatch,useSelector} from "react-redux"
import {userObj} from "../../redux/modules/user"
import {setUserName} from "../../redux/actionCreator"
import "./index.less"
import { useNavigate} from "react-router-dom";
import { Popup,Space,Button,Swiper,Toast } from 'antd-mobile'
import { SwiperRef } from 'antd-mobile/es/components/swiper'
import { AppstoreOutline } from 'antd-mobile-icons'
import Home1 from '../Home1/Home1'
import axios from "../../utils/utils"
interface Iobj{
    encodeId:string
    exclusive: false
    imageUrl: string
    scm: string
    song: null
    targetId: number
    targetType: 1
    titleColor: string
    typeTitle: string
    url: null
    video: null
    }
interface Point extends Iobj { y: number; }
const colors = ['#ace0ff', '#bcffbd', '#e4fabd', '#ffcfac']
const items = colors.map((color, index) => (
    <Swiper.Item key={index}>
      <div
        className='antdcontent'
        style={{ background: color }}
        onClick={() => {
          Toast.show(`你点击了卡片 ${index + 1}`)
        }}
      >
        <img src="../../../static/assets/img/banner.png" alt="" />
      </div>
    </Swiper.Item>
  ))
export default function HomePersionCenter() {
    const [num,SetNum] = useState(0)
    const [lunbo,setlunboArr] = useState<Iobj[]>([])
    const [lunbo2,setlunboArr2] = useState<Iobj[]>([])
    const [visible3, setVisible3] = useState(false)
    const ref = useRef<SwiperRef>(null)
    let navigate = useNavigate();
    const jump = () =>{
        navigate('/children');
        console.log(setlunboArr,setlunboArr2,'fff')
    }
    const dispatch = useDispatch()
     const name = useSelector((state:userObj) => state.user.name)
    useEffect(()=>{
        setTimeout(() => {
            dispatch(setUserName(`${name}123`))
        }, 2000);
        //函数
        //   如果,[]就只执行一次
        // 如果空的  逗号都不写 随便数据每次更新都会执行
        // 如果都写，[]数组里的数据更新才会执行
    },[])
    const getFunc = (value:number) => {
      let a = value
      setParentCountt(value);
      return a
    }
    const [parentCount, setParentCountt] = useState<number>(0);
 

    return (
        <div className="message">
        HomePersionCenter
        </div>
    )
}